# 开始入门
# print('hello world')
# 入门结束

# no = input("请输入你的车牌号：")
# print('发车》》' + no)


# 1.可变的有序列表 理解为java数组
# childList = [1, 2]
# List = ["啊", "去", 1, 6.00, False, True, childList]
# print("可变的有序列表:")
# print(len(List))
# print(List[6][0])
# print(List[-1])
# # 末尾加
# List.append("大")
# print(List)
# # 指定位置加
# List.insert(0, 111)
# print(List)
# # 指定位置删
# List.pop(-1)
# print(List)
# # 替换
# List[0] = '2222'
# print(List)

# 2.不可变有序列表 - 元组 tuple,理解为java对象
# 切记元组 tuple元素不可变！！！！！！
# tupleObj = ("a", "b", [1, 2, 3])
# print(tupleObj)
# print(tupleObj[0])
# # 但是如果里面有list列表 可以更改！
# tupleObj[2][0] = "222"
# print(tupleObj)
# print(type(tupleObj))
# print(type(tupleObj[2]))

# 3.dict字典（K-V）类似java的hashmap
dictobj = {"a": 1, "b": 2, "c": 3}
print(dictobj)
print(dictobj["a"])
dictobj["a"] = 4
print(dictobj)
dictobj.pop("a")
print(dictobj)
dictobj_copy = dictobj.copy()
print(dictobj_copy)
# 获取字典K
print(dictobj.keys())
# 以列表方式返回的元组数组
print(dictobj.items())
# 获取K对应值
getK = dictobj.get("b")
print(getK)

# set类似java set 不能重复
setobj = set([1, 2, 3])
print(setobj)
print(type(setobj))

# 3. 变量和常量
# 不同类型之前变量可以随便赋值
a = 123
a = "123"
print(len(a))

# 占位符
print("你好,%s" % "老司机")
print("你好,{0}".format('666'))

# 条件判断
a = 100
if a >= 0:
    print(a)
else:
    print(-a)

# 循环
names = ['Michael', 'Bob', 'Tracy']
for name in names:
    print(name)


sum = 0
for x in range(101):
    sum = sum + x
print(sum)  # 5050
